﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.webuser
{
    public partial class repwd : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_save_Click(object sender, EventArgs e)
        {
            Hashtable user = PhoneBook.Users.Users.get(Commons.StrUtil.FormatValue(Session["userid"]));
            if (user == null) return;

            Dx.ZcEncrypt.Encrypt3DES encrypt = new Dx.ZcEncrypt.Encrypt3DES();
            if (!encrypt.ValidPwdBy3des(txb_old.Text, Commons.StrUtil.FormatValue(user["userpwd"])))
            {
                Helper.ShowMessage(u_message, controls.UCMessageType.success, "旧密码错误");
                return;
            }

            user["userpwd"] = txb_new.Text;//encrypt.EncryptString(Dx.ZcEncrypt.Encrypt.GetMD5(txb_new.Text));

            PhoneBook.Users.Users.edit(user);
            Helper.ShowMessage(u_message, controls.UCMessageType.success, "保存成功");

            AddLog("用户({0})修改了密码", user["userid"]);
        }
    }
}